Code
install.packages("leaflet")
install.packages('sp')
install.packages('sf')
install.packages('tmap')Installing packages (run once)
install.packages("leaflet")
install.packages('sp')
install.packages('sf')
install.packages('tmap')Downloading the dataset (run once)
download.file('https://opendata.arcgis.com/api/v3/datasets/ebb2e1f38f274f2dbbe4cba16c6c66af_0/downloads/data?format=shp&spatialRefId=2914','ez.zip')
unzip('ez.zip',exdir='ez')Loading the libraries
library(leaflet)
library(sp)
library(sf)
library(tmap)
library(purrr)Creating the map
ez=st_make_valid(read_sf('ez'))
m=tm_shape(ez)
p=partial(tm_polygons,col="zonecode",popup.v=c("zonecode","zonename","SHAPE_Area"),al=0.7,style="cat",pal='Accent',border.a=0.1)
tmap_leaflet(m+p(legend.show=F))m+p(legend.is.p=F)+tm_layout(legend.on=T,legend.pos=c('center','top'))